Note: There are often multiple ways to answer each question.
Install and load the MASS
package. Load the nlschools
dataset.
How can we find a description of the nlschools
dataset? Use some of the functions we learned to get a feel for the data.
How many students are there in the dataset?
How many students were there in each class? Which class had the most number of students?
Get a random sample of 10 rows from the dataset. (Hint: Look at the documentation for the sample_n
function in the dplyr
package.)
Make a scatterplot of IQ vs. lang.
There was a lot of overplotting in the previous scatterplot. Make the plot more readable by adding jitter and changing the alpha value of the points. What is the relationship between IQ and lang?
What is the correlation between IQ and lang?
Using the previous chart, color the points according to their value in the COMB column. Does the value of COMB affect the relationship between IQ and lang? What geometry could you add to the chart to check this?
There could be a strong relationship between IQ and social-economic stats (SES). Create a data frame which shows the mean IQ and language test scores of students for each SES value, and present the results in descending order of SES.